package com.stress.testing.plugin.es.strategy;

import org.elasticsearch.action.get.MultiGetRequest;

import java.util.Iterator;
import java.util.List;

public class MultiGetRequestIndexRenameStrategy extends AbstractRequestIndexRenameStrategy {
    @Override
    public void renameIndex(Object arg) {
        MultiGetRequest request = (MultiGetRequest) arg;
        List<MultiGetRequest.Item> items = request.getItems();
        Iterator<MultiGetRequest.Item> iterator = items.iterator();
        while (iterator.hasNext()) {
            MultiGetRequest.Item item = iterator.next();
            item.index(internalRenameIndex(item.index()));
        }
    }
}